package com.hfjyz.registration.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * The persistent class for the office database table.
 * 
 */
public class Office implements Serializable {
	private static final long serialVersionUID = 1L;

	private Integer id;

	private Date applyYear;

	private String code;

	private String degree;

	private String description;

	private Integer examId;

	private String examName;

	private int limitAge;

	private String major;

	private String name;

	private int recruits;

	private Integer departId;

	private String departName;

	private String cityName;

	private int applyCount;

	private int validataCount;

	private int paidCount;

	private int scale;

	private Integer totalUsers;
	private Integer totalSeats;

	private List<Room> rooms;
	private int assignedUsers = 0;
	private List<RoomOffice> roomOffices = new ArrayList<RoomOffice>(5);

	public Office() {
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getExamName() {
		return this.examName;
	}

	public void setExamName(String examName) {
		this.examName = examName;
	}

	public Date getApplyYear() {
		return this.applyYear;
	}

	public void setApplyYear(Date applyYear) {
		this.applyYear = applyYear;
	}

	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getDegree() {
		return this.degree;
	}

	public void setDegree(String degree) {
		this.degree = degree;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Integer getExamId() {
		return this.examId;
	}

	public void setExamId(Integer examPosition) {
		this.examId = examPosition;
	}

	public int getLimitAge() {
		return this.limitAge;
	}

	public void setLimitAge(int limitAge) {
		this.limitAge = limitAge;
	}

	public String getMajor() {
		return this.major;
	}

	public void setMajor(String major) {
		this.major = major;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getRecruits() {
		return this.recruits;
	}

	public void setRecruits(int recruits) {
		this.recruits = recruits;
	}

	public Integer getDepartId() {
		return this.departId;
	}

	public void setDepartId(Integer depart) {
		this.departId = depart;
	}

	/**
	 * @return the departName
	 */
	public String getDepartName() {
		return departName;
	}

	/**
	 * @param departName
	 *            the departName to set
	 */
	public void setDepartName(String departName) {
		this.departName = departName;
	}

	/**
	 * @return the cityName
	 */
	public String getCityName() {
		return cityName;
	}

	/**
	 * @param cityName
	 *            the cityName to set
	 */
	public void setCityName(String cityName) {
		this.cityName = cityName;
	}

	/**
	 * @return the applyCount
	 */
	public int getApplyCount() {
		return applyCount;
	}

	/**
	 * @param applyCount
	 *            the applyCount to set
	 */
	public void setApplyCount(int applyCount) {
		this.applyCount = applyCount;
	}

	/**
	 * @return the validataCount
	 */
	public int getValidataCount() {
		return validataCount;
	}

	/**
	 * @param validataCount
	 *            the validataCount to set
	 */
	public void setValidataCount(int validataCount) {
		this.validataCount = validataCount;
	}

	/**
	 * @return the scale
	 */
	public int getScale() {
		return scale;
	}

	/**
	 * @param scale
	 *            the scale to set
	 */
	public void setScale(int scale) {
		this.scale = scale;
	}

	/**
	 * @return the totalUsers
	 */
	public Integer getTotalUsers() {
		return totalUsers;
	}

	/**
	 * @param totalUsers
	 *            the totalUsers to set
	 */
	public void setTotalUsers(Integer totalUsers) {
		this.totalUsers = totalUsers;
	}

	/**
	 * @return the totalSeats
	 */
	public Integer getTotalSeats() {
		return totalSeats;
	}

	/**
	 * @param totalSeats
	 *            the totalSeats to set
	 */
	public void setTotalSeats(Integer totalSeats) {
		this.totalSeats = totalSeats;
	}

	/**
	 * @return the rooms
	 */
	public List<Room> getRooms() {
		return rooms;
	}

	/**
	 * @param rooms
	 *            the rooms to set
	 */
	public void setRooms(List<Room> rooms) {
		this.rooms = rooms;
	}

	public int getAssignedUsers() {
		return assignedUsers;
	}

	public void setAssignedUsers(int assignedUsers) {
		this.assignedUsers = assignedUsers;
	}

	public List<RoomOffice> getRoomOffices() {
		return roomOffices;
	}

	public void setRoomOffices(List<RoomOffice> roomOffice) {
		this.roomOffices = roomOffice;
		assignedUsers = 0;
		for (RoomOffice ro : roomOffice) {
			assignedUsers += ro.getAssignSeats();
		}
	}

	public void add(RoomOffice ro) {
		roomOffices.add(ro);
		assignedUsers += ro.getAssignSeats();
	}

	public int remain() {
		return totalUsers - assignedUsers;
	}

	public int getPaidCount() {
		return paidCount;
	}

	public void setPaidCount(int paidCount) {
		this.paidCount = paidCount;
	}
}